﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp13
{
    class Program
    {
        static void Main(string[] args)
        {

            SortedList sortlist = new SortedList();
            sortlist.Add(1, "one");
            sortlist.Add(2, "two");
            sortlist.Add(3, "three");
            sortlist.Add(4, "four");
            sortlist.Add(5, "five");

            Console.WriteLine("序号：");


            int id = int.Parse(Console.ReadLine());
            bool flag = sortlist.ContainsKey(id);
            if (flag)
            {
                string num = sortlist[id].ToString();
                Console.WriteLine("该序号内容为：{0}", num);
            }

            else
            {
                Console.WriteLine("无");
            }
            Console.WriteLine();
            Console.WriteLine("所有序号为：");


            foreach (DictionaryEntry v in sortlist)
            {
                int key = (int)v.Key;
                string value = v.Value.ToString();
                Console.WriteLine("序号{0},内容为：{1}", key, value);
            }
        }
    }
}
